package com.tiger.web.controller.transaction;
import com.tiger.common.annotation.Log;
import com.tiger.common.core.controller.BaseController;
import com.tiger.common.core.domain.AjaxResult;
import com.tiger.common.core.page.TableDataInfo;
import com.tiger.common.enums.BusinessType;
import com.tiger.transaction.domain.ComplaintInfo;
import com.tiger.transaction.service.IComplaintInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 【投诉举报】Controller
 *
 * @author standard
 * @date 2022-09-20
 */
@Api(tags = "投诉举报")
@RestController
@RequestMapping("/system/complaintInfo")
public class ComplaintInfoController extends BaseController {
    @Autowired
    private IComplaintInfoService complaintInfoService;

    /**
     * 查询【投诉举报】列表
     */
    @ApiOperation(value = "查询【投诉举报】列表")
    //@PreAuthorize("@ss.hasPermi('system:info:list')")
    @GetMapping("/list")
    public TableDataInfo list(ComplaintInfo complaintInfo) {
        startPage();
        List<ComplaintInfo> list = complaintInfoService.selectComplaintInfoList(complaintInfo);
        return getDataTable(list);
    }



    /**
     * 获取【投诉举报】详细信息
     */
    @ApiOperation(value = "获取【投诉举报】列详细信息")
    //@PreAuthorize("@ss.hasPermi('system:info:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(complaintInfoService.selectComplaintInfoById(id));
    }

    /**
     * 新增【投诉举报】
     */
    @ApiOperation(value = "新增【投诉举报】")
    //@PreAuthorize("@ss.hasPermi('system:info:add')")
    @Log(title = "【投诉举报】", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody ComplaintInfo complaintInfo) {
        return toAjax(complaintInfoService.insertComplaintInfo(complaintInfo));
    }

    /**
     * 修改【投诉举报】
     */
    @ApiOperation(value = "处理【投诉举报】")
    //@PreAuthorize("@ss.hasPermi('system:info:edit')")
    @Log(title = "【投诉举报】", businessType = BusinessType.UPDATE)
    @PutMapping("/edit")
    public AjaxResult edit(@RequestBody ComplaintInfo complaintInfo) {
        return toAjax(complaintInfoService.updateComplaintInfo(complaintInfo));
    }

    /**
     * 删除【投诉举报】
     */
//    @ApiOperation(value = "删除【投诉举报】")
    //@PreAuthorize("@ss.hasPermi('system:info:remove')")
    @Log(title = "【投诉举报】", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(complaintInfoService.deleteComplaintInfoByIds(ids));
    }
}
